/*
 *  flags.cpp
 *  joosVM
 *
 *  Created by Smári Waage on 11.6.2009.
 *  Copyright 2009 smari.org. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. *
 */

//#include <string>
#include "flags.h"


#define T(identifier, string) bool Flags::identifier = false;
FLAG_LIST(T)
#undef T

//bool Flags::terminateExecution;
//int  Flags::terminateStatus = 0;

bool Flags::recordTrace = false;
//byte Flags::traceid = 30;

char* Flags::entryClass = NULL;
char** Flags::entryClassArgs = NULL;
int Flags::entryClassArgc = 0;
char* Flags::classpath = NULL;


void Flags::SetFlagsFromCommandLine(int argc, char** argv){

	int i = 1;
	
	while(  i < argc && argv[i][0] == '-'){
		if (strcmp("-classpath", argv[i++]) == 0) {
			classpath = argv[i++];
		}
#define T(identifier, string) else if (strcmp(string, argv[i]) == 0) identifier = true;
		FLAG_LIST(T)
#undef T
	}
	
	if(i < argc){
		entryClass = argv[i++];
	}

	while(i < argc){
		entryClassArgs[entryClassArgc++] = argv[i++];
	}
}


